/*
 * @Description: 
 * @Author: 47
 * @Date: 2023-01-03 14:22:30
 * @LastEditors: 47
 * @LastEditTime: 2023-02-18 16:12:55
 */
const express = require('express')

// 导入courseController
const courseController = require("../controller/course")

const uploadFile = require('../utils/uploadImg')

const router = express.Router()



router.get('/getMyTestList/:userId?', courseController.getMyTestList)
router.get('/getCourseTestList/:courseId?/:userId?', courseController.getCourseTestList)
router.get('/getCourseHomeworkList/:courseId?/:userId?', courseController.getCourseHomeworkList)
router.get('/getCourseHomeworkDetail/:homeworkId?', courseController.getCourseHomeworkDetail)
router.get('/getCourseTestDetail/:testId?', courseController.getCourseTestDetail)
router.get('/getChapterInfo/:courseId?/:userId?', courseController.getChapterInfo)
router.get('/getChapterDetail/:chapterId?/:userId?', courseController.getChapterDetail)
router.get('/updateDetailTaskPoint/:detailId?/:userId?', courseController.updateDetailTaskPoint)
router.get('/updateChapterTaskPoint/:chapterId?/:userId?', courseController.updateChapterTaskPoint)


router.get('/updateCourseTaskPointNum/:courseId?', courseController.updateCourseTaskPointNum)
router.get('/getCourseTaskPointNum/:courseId?', courseController.getCourseTaskPointNum)

router.get('/getMyOkTaskNumTheCourse/:courseId?/:userId?', courseController.getMyOkTaskNumTheCourse)




// 获取自选课程列表
router.get('/getMoreCourseList', courseController.getMoreCourseList)

// 修改报名状态
router.post('/updateCourseStatus/:courseId?', courseController.updateCourseStatus)

// 获取我的课程列表
router.get('/getMyCourseList/:userId?/:keyword?', courseController.getMyCourseList)

// 将自选课程添加到我的课程
router.post('/addMyCourse', courseController.addMyCourse)

// 根据“courseId”获取课程下的通知列表 
router.get('/getCourseNoticeList/:courseId?/:userId?', courseController.getCourseNoticeList)

//根据“noticeId”获取通知详情页信息以及对应的评论区 
router.get('/getNoticeDetail/:noticeId?/:userId?', courseController.getNoticeDetail)

//根据“courseId”获取课程的讨论列表 
router.get('/getCourseDiscussList/:courseId?/:userId?', courseController.getCourseDiscussList)

//根据“discussId”获取讨论详情页信息以及对应的评论区  
router.get('/getDiscussDetail/:discussId?/:userId?', courseController.getDiscussDetail)

//根据“courseId”获取课程的签到列表 
router.get('/getCourseSignList/:courseId?/:userId?', courseController.getCourseSignList)

//根据noticeId和userId更新通知状态
router.get('/updateNoticeStatus/:noticeId?/:userId?', courseController.updateNoticeStatus)

//根据signId和userId更新签到状态
router.get('/updateSignStatus/:signId?/:userId?', courseController.updateSignStatus)

// 更新签到时间
router.post('/getSignTime', courseController.getSignTime)

// 获取签到成功时间 
router.post('/getSignSuccessTime', courseController.getSignSuccessTime)

// 提交作业/考试内容
router.post('/addContent', courseController.addContent)

//点赞
router.post('/toLike', courseController.toLike)

//查询通知/讨论点赞用户列表
router.get('/getLikeList/:id?/:judgeCode?', courseController.getLikeList)


//添加评论
router.post('/addComment', courseController.addComment)



// 图片上传
let multer = require('multer');
// 文件暂存本地文件夹-自动生成./tmp/
let upload = multer({
    dest: './tmp/'
});

router.post('/upload', upload.single('file'), uploadFile.uploadFile)

module.exports = router